export function checkCollision(rect, otherRects) {
  return otherRects.filter((x) => isRectCollision(rect, x));
}

function isRectCollision(rect1, rect2) {
  return (
    rect1.position.x < rect2.position.x + rect2.width &&
    rect1.position.x + rect1.width > rect2.position.x &&
    rect1.position.y < rect2.position.y + rect2.height &&
    rect1.position.y + rect1.height > rect2.position.y);
}